/**
 *
 */
package com.cmcc.pcap.packet.sctp;

import com.cmcc.pcap.packet.tcp.TcpProtocol;
import com.cmcc.pcap.packet.util.CommonUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.pcap4j.packet.IpPacket;
import org.pcap4j.packet.SctpPacket;
import org.pcap4j.packet.TcpPacket;
import org.pcap4j.packet.namednumber.SctpChunkType;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

/**
 * @Date 2018年1月17日 上午8:35:58
 * @author Amish
 * 
 * (1)包装jpcap.packet.TCPPacket的类型
 * (2)提供辅助信息，如Packet接收时间，是否是tcp 三次握手的第一条消息等
 */
public class SctpPacketDecorator {
	public static Logger logger = LogManager.getLogger(SctpPacketDecorator.class);

	public boolean isNINT = false;//表示是SCTP连接的第一个INIT消息
	public long receiveTime;//非抓包时间
	public SctpProtocol protocol;//应用层协议，默认为空
	public IpPacket ipPacket;
	public SctpPacket sctpPacket;
	public List<SctpPacket.SctpChunk> chunklist;//Sctp报文携带的chunks
	public List<SctpChunkType> chunktypelist;//Sctp协议携带chunktype

	public Timestamp timestamp;//包时间戳
	public long lastPacketTime;//最后一个包的时间 TODO

    public boolean isDuplicateSackMerge = false;//true表示是一个Duplicate ACK merge后的包
    public ArrayList<SctpPacketDecorator> duplicateSackMergeAl;

    public boolean isRetransmissionDataMerge = false;//true表示是一个Retransmission merge后的包
    public ArrayList<SctpPacketDecorator> retransmissionMergeDataAl;

	public SctpPacketDecorator(boolean isNINT){
		this.receiveTime = System.currentTimeMillis();//初始化时获取当前时间(非抓包时间)
		this.isNINT = isNINT;
	}
	
	@Deprecated
	public byte[] getData(){

		return ipPacket.get(SctpPacket.class).getRawData();

	}
	

}
